<template>
    <div>
        <el-form ref="userform" :model='user'
            label-position="left"
            label-width="80px">
            <el-form-item label="username:" prop="username">
                <el-input v-model="user.username"></el-input>
            </el-form-item>
            <el-form-item label="password:" prop="password">
                <el-input v-model="user.password" show-password></el-input>
            </el-form-item>
            <el-button type="primary" @click="reg">注册</el-button>
        </el-form>

    </div>
</template>


<script>
import axios from 'axios'

export default {
  name: 'Reg_zhoukao',
    data() {
        return {
            user:{
                "username":'',
                "password":'',
            }
        }
    },
    methods: {
        //注册按钮
        reg(){
            axios.get('http://127.0.0.1:8000/reg_zk/',{params:{username:this.user.username,password:this.user.password}}).then(res=>{
                console.log(res);
                this.$Message(res.data.data);
                if(res.data.code==200){
                    this.$router.push('/kslogin')
                }
            })
        }
    }
}
</script>
